package com.voxel.sense.infomsg.module.firm.details.institution.inCrease;

import com.example.com.common.app.BasePresenter;
import com.example.com.common.utils.ListUtil;
import com.voxel.sense.infomsg.data.bean.ConditionBean;
import com.voxel.sense.infomsg.utils.cover.BaseCoverStrategy;
import com.voxel.sense.infomsg.utils.cover.ConfigData2ConditionBeanCoverUtile;
import com.voxel.sense.infomsg.utils.manager.QueryConfigManager;

import java.util.ArrayList;
import java.util.List;

import cyy.example.com.facotry.model.api.response.SearchMenuEntity;

/**
 * @author ChenYiYao
 * @date 2018/5/14
 * des :
 */
public class IncreateBranchPresenter extends BasePresenter<IncreaseBranchContract.View> implements IncreaseBranchContract.Presenter {

    private List mBranchStyle;
    private List mEletStyleList;
    private List<ConditionBean> mLocationStyleList;

    public IncreateBranchPresenter(IncreaseBranchContract.View view) {
        super(view);
    }

    @Override
    public void doLoadBranchStyleData() {
        if (ListUtil.isEmpty(mBranchStyle)) {
            SearchMenuEntity roleType = QueryConfigManager.getInstance().getRoleType();
            BaseCoverStrategy strategy = new ConfigData2ConditionBeanCoverUtile();
            mBranchStyle = strategy.convertEntity(roleType, IncreaseBranchContract.BRANSH_STYLE);
        }
        mView.onShowBranchStyleView(mBranchStyle);

    }

    @Override
    public void doLoadElementsStyleData() {
        if (ListUtil.isEmpty(mEletStyleList)) {
            SearchMenuEntity industryType = QueryConfigManager.getInstance().getIndustryType();
            BaseCoverStrategy strategy = new ConfigData2ConditionBeanCoverUtile();
            mEletStyleList = strategy.convertEntity(industryType, IncreaseBranchContract.ELEMENT_STYLE);
        }
        mView.onShowElementsStyleView(mEletStyleList);
    }

    @Override
    public void doLoadElementsData() {
        if (ListUtil.isEmpty(mEletStyleList)) {
            SearchMenuEntity industryType = QueryConfigManager.getInstance().getIndustryType();
            BaseCoverStrategy strategy = new ConfigData2ConditionBeanCoverUtile();
            mEletStyleList = strategy.convertEntity(industryType, IncreaseBranchContract.ELEMENT_STYLE);
        }
        mView.onShowElementsView(mEletStyleList);
    }

    @Override
    public void doLocationStyleData() {
        if (ListUtil.isEmpty(mLocationStyleList)) {
            mLocationStyleList = new ArrayList<>();
            ConditionBean bean1 = new ConditionBean(IncreaseBranchContract.LOCATION_STYLE, "1", "百度坐标系（BD-09）", false);
            ConditionBean bean2 = new ConditionBean(IncreaseBranchContract.LOCATION_STYLE, "1", "火星坐标系（高德，GCJ-02）", false);
            mLocationStyleList.add(bean1);
            mLocationStyleList.add(bean2);
        }
        mView.onShowLocationStyleView(mLocationStyleList);
    }
}
